/**
 * Keafmd
 *
 * @ClassName: Demo5
 * @Description: Demo5
 * @author: lijl
 * @date: 2022/12/11 14:33
 * @Blog: https://keafmd.blog.csdn.net/
 */
interface Solid{
    double getArea();
    double getVolume();
}
class Cube implements Solid{
    private double width,height,depth;
    Cube(double width,double height,double depth){
        this.width = width;
        this.height = height;
        this.depth = depth;
    }
    public double getArea(){
        return (width*height+width*depth+height*depth)*2;
    }
    public double getVolume(){
        return width*height*depth;
    }
}
class Sphere implements Solid{
    private double radius;
    Sphere(double radius){
        this.radius = radius;
    }
    public double getArea(){
        return 4*Math.PI*radius*radius;
    }
    public double getVolume(){
        return 4.0/3*Math.PI*radius*radius*radius;
    }
}
public class Demo5 {
    public static void main(String[] args) {
        Cube c = new Cube(3,4,5);
        System.out.println("立方体的表面积是"+c.getArea());
        System.out.println("立方体的体积是"+c.getVolume());
        Sphere s = new Sphere(1);
        System.out.println("球的表面积是"+s.getArea());
        System.out.println("球的体积是"+s.getVolume());
    }
}
